import 'package:domeall/text/text_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'get_jump_one/get_jump_one_view.dart';
import 'get_jump_two/get_jump_two_view.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      getPages: [
        GetPage(name: '/one', page: ()=>GetJumpOnePage()),
        GetPage(name: '/two', page: ()=>GetJumpTwoPage()),
      ],
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
  int cIndex=0;
  final tabs = ['风', '雨', '雷', '电'];
  late TabController tabController;

  //初始化tabController
  @override
  void initState() {
    super.initState();
    tabController = TabController(length: tabs.length, vsync: this);
  }

  @override
  void dispose() {
    tabController.dispose();
    super.dispose();
  } //释放tabController

  @override
  Widget build(BuildContext context) {
    return GetJumpOnePage();
    // return Scaffold(
    //   appBar: AppBar(
    //     title: Text('测试'),
    //     centerTitle: true,
    //     bottom: TabBar(
    //       onTap: (tab) {
    //         print(tab);
    //         setState(() {
    //           cIndex = tab;
    //         });
    //       },
    //       controller: tabController,
    //       tabs: tabs
    //           .map((e) => Tab(
    //                 text: e,
    //               ))
    //           .toList(),
    //     ),
    //     actions: [cIndex == 2?Icon(Icons.search):Text('不对')],
    //   ),
    //   body: TabBarView(
    //     controller: tabController,
    //     children: [
    //       Text('1111'),
    //       Text('2222'),
    //       Text('3333'),
    //       Text('4444'),
    //     ],
    //   ),
    // );
  }
}
